<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: Eeprom</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>Eeprom<br>
<small>
[<a class="el" href="group___controller.html">Controller</a>]</small>
</h1>Eeprom allows for the persistent storage of 32k bytes data.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___eeprom.html#g0f3449ca4a5f092e3cdf605799d14fc6">Eeprom_SetActive</a> (int state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the active state of the EEPROM subsystem.  <a href="#g0f3449ca4a5f092e3cdf605799d14fc6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___eeprom.html#g04eebd476f28804ef10866f692a78f4f">Eeprom_GetActive</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the active state of the EEPROM.  <a href="#g04eebd476f28804ef10866f692a78f4f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___eeprom.html#g03d8b089bb0d04209e032ea233218d3a">Eeprom_Write</a> (int address, uchar *buffer, int count)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Write data to the EEPROM.  <a href="#g03d8b089bb0d04209e032ea233218d3a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___eeprom.html#g95bd921a774026d4cc96b20d6a20d9dd">Eeprom_Read</a> (int address, uchar *buffer, int count)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read data from the EEPROM.  <a href="#g95bd921a774026d4cc96b20d6a20d9dd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___eeprom.html#g0d984a59a03896a61603790ba16dbbad">Eeprom_GetLastAddress</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the last usable address in the EEPROM.  <a href="#g0d984a59a03896a61603790ba16dbbad"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Eeprom allows for the persistent storage of 32k bytes data. 
<p>
The last 1k (1024) bytes of this space are reserved for system use storing things like the board's IP address, serial number, build version, etc. Get the last EEPROM address available before this reserved section with a call to <a class="el" href="group___eeprom.html#g0d984a59a03896a61603790ba16dbbad" title="Returns the last usable address in the EEPROM.">Eeprom_GetLastAddress( )</a>.<p>
Use <a class="el" href="group___eeprom.html#g03d8b089bb0d04209e032ea233218d3a" title="Write data to the EEPROM.">Eeprom_Write()</a> and <a class="el" href="group___eeprom.html#g95bd921a774026d4cc96b20d6a20d9dd" title="Read data from the EEPROM.">Eeprom_Read()</a> to store and retrieve characters. These both internally set the EEPROM system to active automatically.<p>
Internally, Eeprom relies on <a class="el" href="group___spi.html">Spi</a>, so activating Eeprom also activates <a class="el" href="group___spi.html">Spi</a>. <hr><h2>Function Documentation</h2>
<a class="anchor" name="g04eebd476f28804ef10866f692a78f4f"></a><!-- doxytag: member="eeprom.c::Eeprom_GetActive" ref="g04eebd476f28804ef10866f692a78f4f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Eeprom_GetActive           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the active state of the EEPROM. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>State - 1/non-zero (on) or 0 (off). </dd></dl>

<p>Definition at line <a class="el" href="eeprom_8c-source.html#l00094">94</a> of file <a class="el" href="eeprom_8c-source.html">eeprom.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g0d984a59a03896a61603790ba16dbbad"></a><!-- doxytag: member="eeprom.c::Eeprom_GetLastAddress" ref="g0d984a59a03896a61603790ba16dbbad" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Eeprom_GetLastAddress           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the last usable address in the EEPROM. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>address </dd></dl>

<p>Definition at line <a class="el" href="eeprom_8c-source.html#l00191">191</a> of file <a class="el" href="eeprom_8c-source.html">eeprom.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g95bd921a774026d4cc96b20d6a20d9dd"></a><!-- doxytag: member="eeprom.c::Eeprom_Read" ref="g95bd921a774026d4cc96b20d6a20d9dd" args="(int address, uchar *buffer, int count)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Eeprom_Read           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uchar *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>count</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read data from the EEPROM. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>address</em>&nbsp;</td><td>An integer specifying the address to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>buffer</em>&nbsp;</td><td>A pointer to the buffer to read into. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>An integer specifying the number of bytes to read. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="eeprom_8c-source.html#l00151">151</a> of file <a class="el" href="eeprom_8c-source.html">eeprom.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g0f3449ca4a5f092e3cdf605799d14fc6"></a><!-- doxytag: member="eeprom.c::Eeprom_SetActive" ref="g0f3449ca4a5f092e3cdf605799d14fc6" args="(int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Eeprom_SetActive           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the active state of the EEPROM subsystem. 
<p>
This is automatically set to true by any call to Eeprom_Write or Eeprom_Read. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state</em>&nbsp;</td><td>An integer specifying the active state - 1 (on) or 0 (off). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>CONTROLLER_OK (=0) on success. </dd></dl>

<p>Definition at line <a class="el" href="eeprom_8c-source.html#l00082">82</a> of file <a class="el" href="eeprom_8c-source.html">eeprom.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g03d8b089bb0d04209e032ea233218d3a"></a><!-- doxytag: member="eeprom.c::Eeprom_Write" ref="g03d8b089bb0d04209e032ea233218d3a" args="(int address, uchar *buffer, int count)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Eeprom_Write           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uchar *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>count</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Write data to the EEPROM. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>address</em>&nbsp;</td><td>An integer specifying the address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>buffer</em>&nbsp;</td><td>A pointer to the buffer to write from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>An integer specifying the number of bytes to write. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>status. </dd></dl>

<p>Definition at line <a class="el" href="eeprom_8c-source.html#l00106">106</a> of file <a class="el" href="eeprom_8c-source.html">eeprom.c</a>.</p>

</div>
</div><p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
